Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STUTL-48 exportCSV - render download link to OverlayContainer rather than document.body #91

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

JohnC-80
Copy link
Contributor

@JohnC-80 JohnC-80 commented Dec 2, 2024

Copy link

github-actions bot commented Dec 2, 2024

Jest Unit Test Results

 1 files  ±0  10 suites  ±0   5s ⏱️ ±0s
51 tests ±0  51 ✅ ±0  0 💤 ±0  0 ❌ ±0 
54 runs  ±0  54 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit d2365f3. ± Comparison against base commit a08924f.

Copy link

sonarcloud bot commented Dec 2, 2024

Copy link
Member

@zburke zburke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deprecation notice on this component has been here for three years. We can include this fix in a Ramsons bugfix release if we think it's necessary, but if not, we should finally just delete this component.

JohnC-80 added a commit to folio-org/stripes-components that referenced this pull request Dec 3, 2024
## [STCOM-1387](https://folio-org.atlassian.net/browse/STCOM-1387)

The focus-trapping logic of Modal (via `focus-trap`) causes the
`click()` event not to trigger on the download link rendered by
`ExportCSV` because the link is appended outside of the focus-trapped
element (in the body.)

Approach: 
Rendering the link within the `div#OverlayContainer` places it in within
the `focus-trapping` boundary. Since this element is always present in
the stripes UI, it's okay to render here. For tests where the
`OverlayContainer` may not exist, the logic falls back to the body.

Additionally, the `exportCSV` logic would simply click the link and then
remove it. This may not cause the focus to move, but it's a safe
accessibility measure to return focus to the element it was originally
on prior to clicking the download trigger.

A similar fix is required in `stripes-util` since we're not sure how
many ui modules use THAT version of `ExportCSV`... That PR:
folio-org/stripes-util#91
github-actions bot pushed a commit to folio-org/stripes-components that referenced this pull request Dec 3, 2024
## [STCOM-1387](https://folio-org.atlassian.net/browse/STCOM-1387)

The focus-trapping logic of Modal (via `focus-trap`) causes the
`click()` event not to trigger on the download link rendered by
`ExportCSV` because the link is appended outside of the focus-trapped
element (in the body.)

Approach: 
Rendering the link within the `div#OverlayContainer` places it in within
the `focus-trapping` boundary. Since this element is always present in
the stripes UI, it's okay to render here. For tests where the
`OverlayContainer` may not exist, the logic falls back to the body.

Additionally, the `exportCSV` logic would simply click the link and then
remove it. This may not cause the focus to move, but it's a safe
accessibility measure to return focus to the element it was originally
on prior to clicking the download trigger.

A similar fix is required in `stripes-util` since we're not sure how
many ui modules use THAT version of `ExportCSV`... That PR:
folio-org/stripes-util#91
@JohnC-80
Copy link
Contributor Author

JohnC-80 commented Dec 3, 2024

@zburke yeah, we probably want to patch - a handful of places still use this...
https://github.com/search?q=org%3Afolio-org+%22%7B+exportCSV+%7D%22&type=code

@JohnC-80 JohnC-80 merged commit bd31a5b into master Dec 3, 2024
15 checks passed
@JohnC-80 JohnC-80 deleted the STUTL-48 branch December 3, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants